forum

home / developersection / forums / saving c# expression tree to a file

Saving C# Expression Tree to a File

marcel ethan 3680 09-Feb-2014

I want to debug an expression and save the expression tree to a file:

 

var generator = DebugInfoGenerator.CreatePdbGenerator();

var document = Expression.SymbolDocument(fileName: "MyDebug.txt");

var debugInfo = Expression.DebugInfo(document, 6, 9, 6, 22);

var expressionBlock = Expression.Block(debugInfo, fooExpression);

var lambda = Expression.Lambda(expressionBlock, parameters);

lambda.CompileToMethod(method, generator);

var bakedType = type.CreateType();

return (type)bakedType.GetMethod(method.Name).Invoke(null, parameters);

How can I find or save "MyDebug.txt"?


c# c# 
Updated on 09-Feb-2014
marcel ethan

Other


Message
Can you answer this question?

Answer

1 Answers

Liked By